import { takeEvery, put, delay} from "@redux-saga/core/effects";
import { increment } from "../actions/counter.actions";
import { INCREMENT_SAGA } from "../const/counter.const";

// takeEvery:接受 action (第一个参数接受的是类型)
// put: 触发 action

function* increment_saga_fun(action){
   yield delay(2000)
   yield put(increment(action.payLoad))
}

export default function* counterSaga (){
  yield takeEvery(INCREMENT_SAGA,increment_saga_fun)
}
